<div class="form-container">
<div class="validation-errors" id="validationErrors" style="display:none;"></div>
<div class="walk-register-buttons" style="float: right;">
	<a href="<?php echo( base_url() ); ?>cmb/member/homepage_logout/<?php echo( $adminUrlKey ); ?>/"><img src="<?php echo( base_url() ); ?>assets/images/buttons/logout1.gif" border="0" /></a>
</div>
<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );
			
	echo( form_open(base_url() . 'cmb/member_registration/admin_edit_account_process/' .$urlKey.'/', array('id' => 'adminEditAccountForm') ) );

	Spacer::Render(0, 15);
	//Primary member info
	//----------------------------------------
	Spacer::Render(0, 60);
	echo('<font color = "blue">'.$loggedinname.' is currently logged in</font>');
	Spacer::Render(0, 10);
	echo('<b>Primary Member Info</b>');
	echo('<hr />');
	Form::OpenFormItem('Primary Member First Name:', 260);
		echo( form_label($accountinfo->getFirstName(), 'seva', 'style="width: 20px;" ') );
	Form::CloseFormItem();
	Form::OpenFormItem('Primary Member Last Name:', 260);
		echo( form_label($accountinfo->getLastName(), 'seva', 'style="width: 20px;" ') );
	Form::CloseFormItem();
	Form::OpenFormItem('Primary Member Email:', 260);
		echo( form_input(array('name'=>'primaryEmail','id'=>'primaryEmail','value'=>$accountinfo->getEmail1(),'style'=>'width: 250px;')) );
	Form::CloseFormItem();
	Form::OpenFormItem('Confirm Primary Member Email:', 260);
		echo( form_input(array('name'=>'primaryEmailConfirm','id'=>'primaryEmailConfirm','value'=>$accountinfo->getEmail1(),'style'=>'width: 250px;')) );
	Form::CloseFormItem();
	Form::OpenFormItem('Primary Member Home Phone: </br><font size="2" color="red">(xxx-xxx-xxxx)</font>', 260);
		echo( form_input(array('name'=>'homePhoneNumber','id'=>'homePhoneNumber','value'=>$accountinfo->getPhone1(),'maxlength'=>'12','style'=>'width: 250px;')) );
	Form::CloseFormItem();
	Form::OpenFormItem('Primary Member Mobile Phone: </br><font size="2" color="red">(xxx-xxx-xxxx)</font>', 260);
		echo( form_input(array('name'=>'mobilePhoneNumber','id'=>'mobilePhoneNumber','value'=>$accountinfo->getPhone2(),'maxlength'=>'12','style'=>'width: 250px;')) );
	Form::CloseFormItem();
	Form::OpenFormItem('Primary Member Company Name:', 260);
		echo( form_input(array('name'=>'orgname','id'=>'orgname','value'=>$accountinfo->getOrgName(),'style'=>'width: 250px;')) );
	Form::CloseFormItem();
	Form::OpenFormItem('Volunteer interests:', 360);
	Form::CloseFormItem();
	$volIntArray = split(',',$accountinfo->getVolInt());
	
	$myArray = array(1 => "Temple", 2 => "Balavihar", 3 => "Language", 4 => "Seva", 5 => "Spiritual", 6 => "Cultural", 7 => "Marketing", 8 => "Website", 9 => "Accounting", 10 => "Fund-Raising", 11 => "Audio-Visual", 12 => "Event-Logistics");
	
	Spacer::Render(0, 2);

	for( $i = 1; $i < 13; $i++ )
	{
		$flg = FALSE;
		for( $j = 0; $j < count($volIntArray); $j++ )
		{
			if ($volIntArray[$j] == $myArray[$i])
			{
				$flg = TRUE;
			}
		}

		if ($flg)
		{
			echo( form_checkbox('volArea'.$i, $myArray[$i], TRUE, 'style="width: 20px;" ') );
			echo( form_label($myArray[$i], $myArray[$i], 'style="width: 20px;" ') );					
		}
		else
		{
			echo( form_checkbox('volArea'.$i, $myArray[$i], FALSE, 'style="width: 20px;" ') );
			echo( form_label($myArray[$i], $myArray[$i], 'style="width: 20px;" ') );					
		}

		Spacer::Render(0, 6);
	}				
	//----------------------------------------

	if($accountinfo->getSpouseFirstName() != "")
	{
		//Spouse info
		//----------------------------------------
		Spacer::Render(0, 20);
		echo('<b>Spouse Info</b>');
		echo('<hr />');
		Form::OpenFormItem('Spouse First Name:', 260);
			echo( form_label($accountinfo->getSpouseFirstName(), 'seva', 'style="width: 20px;" ') );
		Form::CloseFormItem();
		Form::OpenFormItem('Spouse Last Name:', 260);
			echo( form_label($accountinfo->getSpouseLastName(), 'seva', 'style="width: 20px;" ') );
		Form::CloseFormItem();
		Form::OpenFormItem('Spouse Email:', 260);
			echo( form_input(array('name'=>'spouseEmail','id'=>'spouseEmail','value'=>$accountinfo->getSpouseEmail1(),'style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Confirm Spouse Email:', 260);
			echo( form_input(array('name'=>'spouseEmailConfirm','id'=>'spouseEmailConfirm','value'=>$accountinfo->getSpouseEmail1(),'style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Spouse Home Phone Number: </br><font size="2" color="red">(xxx-xxx-xxxx)</font>', 260);
			echo( form_input(array('name'=>'spousePhone','id'=>'spousePhone','value'=>$accountinfo->getSpousePhone1(),'maxlength'=>'12','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Spouse Mobile Phone Number: </br><font size="2" color="red">(xxx-xxx-xxxx)</font>', 260);
			echo( form_input(array('name'=>'spouseMobilePhone','id'=>'spouseMobilePhone','value'=>$accountinfo->getSpousePhone2(),'maxlength'=>'12','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Volunteer interests:', 360);
		Form::CloseFormItem();
		$volIntArray = split(',',$accountinfo->getSpouseVolInt());
		Spacer::Render(0, 2);

		for( $i = 1; $i < 13; $i++ )
		{
			$flg = FALSE;
			for( $j = 0; $j < count($volIntArray); $j++ )
			{
				if ($volIntArray[$j] == $myArray[$i])
				{
					$flg = TRUE;
				}
			}

			if ($flg)
			{
				echo( form_checkbox('spouseVolArea'.$i, $myArray[$i], TRUE, 'style="width: 20px;" ') );
				echo( form_label($myArray[$i], $myArray[$i], 'style="width: 20px;" ') );					
			}
			else
			{
				echo( form_checkbox('spouseVolArea'.$i, $myArray[$i], FALSE, 'style="width: 20px;" ') );
				echo( form_label($myArray[$i], $myArray[$i], 'style="width: 20px;" ') );					
			}

			Spacer::Render(0, 6);
		}
		//----------------------------------------
	}
												
	//Household info (stored with primary member)
	//----------------------------------------		
	Spacer::Render(0, 20);
	echo('<b>Household Info</b>');
	echo('<hr />');
	Form::OpenFormItem('Home Address 1:', 260);
		echo( form_input(array('name'=>'homeAddress1','id'=>'homeAddress1','value'=>$accountinfo->getAddress1(),'style'=>'width: 250px;')) );
	Form::CloseFormItem();
	Form::OpenFormItem('Home Address 2:', 260);
		echo( form_input(array('name'=>'homeAddress2','id'=>'homeAddress2','value'=>$accountinfo->getAddress2(),'style'=>'width: 250px;')) );
	Form::CloseFormItem();
	Form::OpenFormItem('City:', 260);
		echo( form_input(array('name'=>'city','id'=>'city','value'=>$accountinfo->getCity(),'style'=>'width: 250px;')) );
	Form::CloseFormItem();
	Form::OpenFormItem('State:', 260);
		$stateOptions = array(''=>'Select','AL'=>'Alabama','AK'=>'Alaska','AZ'=>'Arizona','AR'=>'Arkansas','CA'=>'California','CO'=>'Colorado','CT'=>'Connecticut','DE'=>'Delaware','DC'=>'District of Columbia','FL'=>'Florida','GA'=>'Georgia','HI'=>'Hawaii','ID'=>'Idaho','IL'=>'Illinois','IN'=>'Indiana','IA'=>'Iowa','KS'=>'Kansas','KY'=>'Kentucky','LA'=>'Louisiana','ME'=>'Maine','MD'=>'Maryland','MA'=>'Massachusetts','MI'=>'Michigan','MN'=>'Minnesota','MS'=>'Mississippi','MO'=>'Missouri','MT'=>'Montana','NE'=>'Nebraska','NV'=>'Nevada','NH'=>'New Hampshire','NJ'=>'New Jersey','NM'=>'New Mexico','NY'=>'New York','NC'=>'North Carolina','ND'=>'North Dakota','OH'=>'Ohio','OK'=>'Oklahoma','OR'=>'Oregon','PA'=>'Pennsylvania','RI'=>'Rhode Island','SC'=>'South Carolina','SD'=>'South Dakota','TN'=>'Tennessee','TX'=>'Texas','UT'=>'Utah','VT'=>'Vermont','VA'=>'Virginia','WA'=>'Washington','WV'=>'West Virginia','WI'=>'Wisconsin','WY'=>'Wyoming');
		echo( form_dropdown('state', $stateOptions, $accountinfo->getState(), 'id="state" style="width: 120px;" ') );
	Form::CloseFormItem();
	Form::OpenFormItem('Zip Code:', 260);
		echo( form_input(array('name'=>'zipCode','id'=>'zipCode','value'=>$accountinfo->getZip(),'style'=>'width: 100px;')) );
	Form::CloseFormItem();
	//----------------------------------------
												
	echo( form_close() );
?>
	
	<div class="form-button-container">
		<a href="javascript: validate();"><img src="<?php echo( base_url() );?>assets/images/buttons/submit_off1.gif" border="0" onmouseover="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_over1.gif';" onmousedown="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_on1.gif';" onmouseup="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_off1.gif';" onmouseout="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_off1.gif';" /></a>
	</div>
</div>

<script type="text/javascript">
	function validate()
	{
		new Ajax.Request(baseUrl + 'validation/member_registration_validation/validate_admin_edit_account/', 
		{
			method:'post',
			parameters: Form.serialize( $('adminEditAccountForm') ),
		  	onSuccess: function(response)
			{
				var result = response.responseText;
				
				if( result == 'VALIDATION_SUCCESS' )
				{
					$('adminEditAccountForm').submit();
				}
				else
				{
					$('validationErrors').innerHTML = result;
					$('validationErrors').show();
					Effect.ScrollTo('validationErrors', { duration:'0.2', offset:-20 });
				}
			},
			onFailure: function(response){var result = response.responseText; $('validationErrors').innerHTML = result;
					$('validationErrors').show();alert('failed') }
		});
	}
</script>
